package com.dcy.znoa.domain.publiz;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.dcy.znoa.domain.Oper;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

/**
 * @author pengyu  公告和接收人的关联表
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("mess_notice")
public class MessNotice {

    @TableId(type = IdType.AUTO, value = "notice_id")
    Long noticeId;//公告ID

    @TableField("mess_id")
    Long messId;//消息ID

    @TableField(exist = false)
    String title;//消息标题 ，来自message 表

    @TableField(exist = false)
    String messTitle;//消息标题 ，来自message 表

    @TableField(exist = false)
    String txt;//消息内容，来自message 表

    @TableField("receive_time")
    Date receiveTime; //读取时间,按这个字段是否为空来判断是否已读

    @TableField
    Long receiveOperId; // receive_oper_id

    @TableField("valid_flag")
    Integer validFlag;

    @TableField(exist = false)
    Message  message;

    @TableField(exist = false)
    String pubman;//发布人，来源于message表，来源于sys_oper表

    @TableField(exist = false)
    Date sendTime;//发布时间，来源于message表，来源于sys_oper表

    //以下是message表中的字段
    @TableField(exist = false)
    Integer messType;//mess_type
    @TableField(exist = false)
    String entityTbl;
    @TableField(exist = false)
    Long entityId;//

    @TableField(exist = false)
    Long createOperId;

    @TableField(exist = false)
    Date createTime;

    @TableField(exist = false)
    String operName;

    @TableField(exist = false)
    String compName;

    @TableField(exist = false)
    String depName;

    @TableField(exist = false)
    String phoneNo;
    @TableField(exist = false)
    Integer isSms;//是否发送短信

    public MessNotice(Long messId, Long receiveOperId) {
        this.messId = messId;
        this.receiveOperId = receiveOperId;
    }
    public MessNotice(Long messId, Long receiveOperId,Integer validFlag,Date sendTime) {
        this.messId = messId;
        this.receiveOperId = receiveOperId;
        this.validFlag = validFlag;
        this.sendTime = sendTime;
    }
}
